<template>
	<!-- 维保人员 添加/编辑/详情 -->
	<div class="compile">
		<el-dialog :close-on-click-modal='false' :append-to-body='true' :before-close='close' :close-on-press-escape='false'
		 :title="title" :visible.sync="addAndCompileShow">
			<el-form :model="form" :rules="rules" ref="form" v-loading='isLoading'>
				<el-row>
					<div class="textLeft titleMessNow">维保人员信息:</div>
				</el-row>
				<el-row>
					<el-col :span="10" :offset='1'>
						<el-form-item label="维保单位:" :label-width="formLabelWidth" prop="company">
							<el-select size="mini" v-model="form.company" placeholder="请选择维保单位" clearable :disabled='detailDisable'>
								<el-option v-for="item in companyUnitArr" :value="item.value" :label="item.label" :key='item.value'>
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="10" :offset='2'>
						<el-form-item label="人员状态:" :label-width="formLabelWidth" prop="personStatus">
							<el-select size="mini" v-model="form.personStatus" placeholder="请选择人员状态" clearable :disabled='detailDisable'>
								<el-option v-for="item in personStatusArr" :value="item.value" :label="item.label" :key='item.value'>
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="10" :offset='1'>
						<el-form-item label="身份证号:" :label-width="formLabelWidth" prop="identity">
							<el-input size="mini" v-model="form.identity" autocomplete="off" clearable :disabled='detailDisable'></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="10" :offset='2'>
						<el-form-item label="家庭住址:" :label-width="formLabelWidth" prop="homeAddress">
							<el-input size="mini" v-model="form.homeAddress" autocomplete="off" clearable :disabled='detailDisable'></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="10" :offset='1'>
						<el-form-item label="T1证号:" :label-width="formLabelWidth">
							<el-input size="mini" v-model="form.t1Papers" autocomplete="off" clearable :disabled='detailDisable'></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="10" :offset='2'>
						<el-form-item label="T1证有效期:" :label-width="formLabelWidth">
							<el-date-picker size="mini" v-model="form.t1PapersTime" type="date" placeholder="请选择T1证有效期" format="yyyy-MM-dd"
							 value-format="yyyy-MM-dd" clearable :disabled='detailDisable'>
							</el-date-picker>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="10" :offset='1'>
						<el-form-item label="T2证号:" :label-width="formLabelWidth">
							<el-input size="mini" v-model="form.t2Papers" autocomplete="off" clearable :disabled='detailDisable'></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="10" :offset='2'>
						<el-form-item label="T2证有效期:" :label-width="formLabelWidth">
							<el-date-picker size="mini" v-model="form.t2PapersTime" type="date" placeholder="请选择T2证有效期" format="yyyy-MM-dd"
							 value-format="yyyy-MM-dd" clearable :disabled='detailDisable'>
							</el-date-picker>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="10" :offset='1'>
						<el-form-item label="合同开始日期:" :label-width="formLabelWidth" prop="pactStartTime">
							<el-date-picker size="mini" v-model="form.pactStartTime" type="date" placeholder="请选择合同开始日期" format="yyyy-MM-dd"
							 value-format="yyyy-MM-dd" clearable :disabled='detailDisable'>
							</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="10" :offset='2'>
						<el-form-item label="合同结束日期:" :label-width="formLabelWidth" prop='pactEndTime'>
							<el-date-picker size="mini" v-model="form.pactEndTime" type="date" placeholder="请选择合同结束日期" format="yyyy-MM-dd"
							 value-format="yyyy-MM-dd" clearable :disabled='detailDisable'>
							</el-date-picker>
						</el-form-item>
					</el-col>
				</el-row>
				<!-- 证件提交 -->
				<el-row>
					<div class="textLeft titleMessNow">证件提交:</div>
				</el-row>
				<el-row>
					<el-col :span="10" :offset="1">
						<el-form-item label="T1证附件:" :label-width="formLabelWidth">
							<el-upload :on-preview="upLoadPreview" action="" accept=".jpg,.jpeg,.png" :file-list="fileList" :on-change="upLoadChange"
							 :on-remove="upLoadRemove" :auto-upload="false" list-type="picture" name="upfile" :disabled='detailDisable'>
								<el-button size="mini" type="primary" :disabled='detailDisable'>点击上传</el-button>
								<div slot="tip" class="upLoadText">只能上传JPG/PNG/JPEG图片,大小不超过800kb/最多上传1张</div>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="10" :offset="2">
						<el-form-item label="T2证附件:" :label-width="formLabelWidth">
							<el-upload :on-preview="upLoadPreview" action="" accept=".jpg,.jpeg,.png" :file-list="fileList1" :on-change="upLoadChange1"
							 :on-remove="upLoadRemove1" :auto-upload="false" list-type="picture" name="upfile" :disabled='detailDisable'>
								<el-button size="mini" type="primary" :disabled='detailDisable'>点击上传</el-button>
								<div slot="tip" class="upLoadText">只能上传JPG/PNG/JPEG图片,大小不超过800kb/最多上传1张</div>
							</el-upload>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="10" :offset="1">
						<el-form-item label="劳动合同附件:" :label-width="formLabelWidth" prop="pactAffix">
							<el-upload :on-preview="upLoadPreview" action="" accept=".jpg,.jpeg,.png" :file-list="fileList2" :on-change="upLoadChange2"
							 :on-remove="upLoadRemove2" :auto-upload="false" list-type="picture" name="upfile" :disabled='detailDisable'>
								<el-button size="mini" type="primary" :disabled='detailDisable'>点击上传</el-button>
								<div slot="tip" class="upLoadText">只能上传JPG/PNG/JPEG图片,大小不超过800kb/最多上传10张</div>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="10" :offset="2">
						<el-form-item label="社保附件:" :label-width="formLabelWidth" prop="pactAffix1">
							<el-upload :on-preview="upLoadPreview" action="" accept=".jpg,.jpeg,.png" :file-list="fileList3" :on-change="upLoadChange3"
							 :on-remove="upLoadRemove3" :auto-upload="false" list-type="picture" name="upfile" :disabled='detailDisable'>
								<el-button size="mini" type="primary" :disabled='detailDisable'>点击上传</el-button>
								<div slot="tip" class="upLoadText">只能上传JPG/PNG/JPEG图片,大小不超过800kb/最多上传1张</div>
							</el-upload>
						</el-form-item>
					</el-col>
				</el-row>
				<!-- 用户账号 -->
				<el-row>
					<div class="textLeft titleMessNow">用户账号</div>
				</el-row>
				<el-row>
					<el-col :span="10" :offset='1'>
						<el-form-item label="账号:" :label-width="formLabelWidth" prop="account">
							<el-input size="mini" v-model.trim="form.account" autocomplete="off" clearable :disabled='detailDisable'></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="2" v-if="title == '编辑维保人员'">
						<span class="brandColor cursor" style='display: inline-block; margin-top: 10px;margin-left: 5px;' @click="openPwd">修改密码</span>
					</el-col>
				</el-row>
				<transition name='el-fade-in-linear'>
					<div v-if="pwdListShow">
						<el-row>
							<el-col :span="10" :offset='1'>
								<el-form-item label="密码:" :label-width="formLabelWidth" prop="pass">
									<el-input size="mini" type="password" v-model.trim="form.pass" autocomplete="off" clearable :disabled='detailDisable'></el-input>
								</el-form-item>
							</el-col>
						</el-row>
						<el-row>
							<el-col :span="10" :offset='1'>
								<el-form-item label="确认密码:" :label-width="formLabelWidth" prop="checkPass">
									<el-input size="mini" type="password" v-model.trim="form.checkPass" autocomplete="off" clearable :disabled='detailDisable'></el-input>
								</el-form-item>
							</el-col>
						</el-row>
					</div>
				</transition>
				<el-row>
					<el-col :span="10" :offset='1'>
						<el-form-item label="真实姓名:" :label-width="formLabelWidth" prop="trueName">
							<el-input size="mini" v-model="form.trueName" autocomplete="off" clearable :disabled='detailDisable'></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="10" :offset='1'>
						<el-form-item label="手机号码:" :label-width="formLabelWidth" prop="phoneNum">
							<el-input size="mini" v-model="form.phoneNum" autocomplete="off" clearable :disabled='detailDisable'></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<!-- 匹配结果 -->
				<div v-if="detailDisable">
					<el-row>
						<div class="textLeft titleMessNow">维保人员签名</div>
					</el-row>
					<el-row>
						<el-col :span="16" :offset='1'>
							<el-form-item label="照片:" :label-width="formLabelWidth">
								<el-image style="width: 100px; height: 100px;float:left;cursor: pointer;" :src="signImg" fit="cover" @click="lookBigImg"></el-image>
								<div slot="error" class="image-slot">
									<i class="el-icon-picture-outline"></i>
								</div>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<div class="textLeft titleMessNow">匹配结果</div>
					</el-row>
					<el-row>
						<el-col :span="16" :offset='1'>
							<el-form-item label="更新状态:" :label-width="formLabelWidth">
								<el-input size="mini" v-model="updataType" autocomplete="off" clearable :disabled='detailDisable'></el-input>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="16" :offset='1'>
							<el-form-item label="最后更新时间" :label-width="formLabelWidth">
								<el-date-picker size="mini" v-model="lastUpdataTime" type="date" placeholder="请选择最后更新时间" format="yyyy-MM-dd HH:mm:ss"
								 value-format="yyyy-MM-dd HH:mm:ss" clearable :disabled='detailDisable'>
								</el-date-picker>
							</el-form-item>
						</el-col>
					</el-row>

					<div class="div" v-if="roleId == 0">
						<el-row>
							<div class="textLeft titleMessNow">备案原始数据</div>
						</el-row>
						<el-row>
							<el-col :span="16" :offset="1">
								<div class="copy" id="content">
									{{recordCon}}
								</div>
								<el-button type="primary" style="margin-left: 170px;margin-top:15px" @click="copy">复制所有请求信息</el-button>
							</el-col>
						</el-row>
						<el-row>
							<el-col :span="16" :offset="1">
								<div class="copy" id="content1">
									{{recordCon1}}
								</div>
								<el-button type="primary" style="margin-left: 170px;margin-top:15px" @click="copy1">复制所有返回信息</el-button>
							</el-col>
						</el-row>
					</div>
				</div>
			</el-form>

			<div slot="footer" class="dialog-footer">
				<el-button @click="close(2)">取 消</el-button>
				<el-button type="primary" @click="submit('form')" v-loading='ensureBtn' v-if="!detailDisable">确 定</el-button>
			</div>
		</el-dialog>
		<el-dialog custom-class="imgDialogShow" :visible.sync="imgDialogShow" :append-to-body='true' :before-close='closeImg'>
			<img :src="dialogImgUrl" alt="">
		</el-dialog>
	</div>
</template>

<script>
	import {
		axiosPost,
		axiosGet,
		loadFn,
		axiosChange,
	} from "@/common.js"
	import {
		company,
		personStatus,
		identity,
		homeAddress,
		pactStartTime,
		pactEndTime,
		account,
		trueName,
		phoneNum,
		pass
	} from "./rule.js"
	export default {
		props: ['addAndCompileShow', 'isAddOrComp', 'rowId'],
		mounted() {
			if (this.title == '添加维保人员') {
				this.isLoading = false
			}
		},
		data() {
			var valiPic = (rule, value, callback) => {
				if (this.fileList2.length === 0) {
					callback(new Error('请上传劳动合同附件'));
				} else {
					callback();
				}
			};
			var valiPic1 = (rule, value, callback) => {
				if (this.fileList3.length === 0) {
					callback(new Error('请上传社保附件'));
				} else {
					callback();
				}
			};
			var validatePass2 = (rule, value, callback) => {
				if (value === '') {
					callback(new Error('请再次输入密码'));
				} else if (value !== this.form.pass) {
					callback(new Error('两次输入密码不一致!'));
				} else {
					callback();
				}
			}
			return {
				formLabelWidth: '120px',
				form: {
					company: localStorage.company_id ? JSON.parse(localStorage.company_id).id : '',
					personStatus: '',
					identity: '',
					homeAddress: '',
					t1Papers: '',
					t1PapersTime: '',
					t2Papers: '',
					t2PapersTime: '',
					pactStartTime: '',
					pactEndTime: '',
					account: '',
					pass: '',
					checkPass: '',
					trueName: '',
					phoneNum: '',
				},
				ensureBtn: false,
				rules: {
					company,
					personStatus,
					identity: [{
						required: true,
						trigger: 'blur',
						validator: identity
					}],
					pactAffix: [{
						required: true,
						trigger: 'blur',
						validator: valiPic
					}],
					pactAffix1: [{
						required: true,
						trigger: 'blur',
						validator: valiPic1
					}],
					homeAddress,
					pactStartTime,
					pactEndTime,
					account,
					pass,
					checkPass: [{
						required: true,
						validator: validatePass2,
						trigger: 'blur'
					}],
					phoneNum: [{
						required: true,
						validator: phoneNum,
						trigger: 'blur'
					}],
					trueName
				},
				fileList: [],
				fileList1: [],
				fileList2: [],
				fileList3: [],
				isLoading: true,
				dialogImgUrl: '',
				imgDialogShow: false,
				updataType: '',
				lastUpdataTime: '',
				recordCon: '',
				recordCon1: '',
				personStatusArr: [{
						label: '在职',
						value: 10
					},
					{
						label: '离职',
						value: 20
					},
				],
				upImg1: '',
				upImg2: '',
				upImg3: [],
				upImg4: '',
				pwdListShow: true,
				signImg: '',
				companyUnitArr: localStorage.company_name ? [{
					label: JSON.parse(localStorage.company_name).name,
					value: JSON.parse(localStorage.company_id).id,
				}] : []
			}
		},
		computed: {
			detailDisable() {
				if (this.title == '维保人员详情') {
					return true
				} else {
					return false
				}
			},
			title() {
				if (this.isAddOrComp == 1) {
					return '添加维保人员'
				} else if (this.isAddOrComp == 2) {
					this.getCompileList()
					return '编辑维保人员'
				} else {
					this.getCompileList()
					return '维保人员详情'
				}
			},
			roleId() {
				if (localStorage.role) {
					return JSON.parse(localStorage.role).id
				} else {
					return ''
				}
			},
		},
		methods: {
			copy() {
				/* 创建range对象   */
				const range = document.createRange();
				range.selectNode(document.getElementById('content'));
				/* 窗口的selection对象，表示用户选择的文本 */
				const selection = window.getSelection();
				if (selection.rangeCount > 0) selection.removeAllRanges(); // 将已经包含的已选择的对象清除掉
				selection.addRange(range); // 将要复制的区域的range对象添加到selection对象中
				document.execCommand('copy'); // 执行copy命令，copy用户选择的文本
			},
			copy1() {
				/* 创建range对象   */
				const range = document.createRange();
				range.selectNode(document.getElementById('content1'));
				/* 窗口的selection对象，表示用户选择的文本 */
				const selection = window.getSelection();
				if (selection.rangeCount > 0) selection.removeAllRanges(); // 将已经包含的已选择的对象清除掉
				selection.addRange(range); // 将要复制的区域的range对象添加到selection对象中
				document.execCommand('copy'); // 执行copy命令，copy用户选择的文本
			},
			//点击图片时触发
			upLoadPreview(file) {
				this.imgDialogShow = true
				this.dialogImgUrl = file.url
			},
			lookBigImg() {
				this.imgDialogShow = true
				this.dialogImgUrl = this.signImg
			},
			//上传文件之前触发
			upLoadChange(file, fileList) {
				const isLt2M = file.size / 1024 < 800;
				if (file.name.split(".")[1] != "jpg" && file.name.split(".")[1] != "png" && file.name.split(".")[1] != "jpeg") {
					this.$message.error('只能上传JPG/PNG/JPEG格式图片');
					this.fileList = fileList.slice(0, -1);
					return
				}
				if (!isLt2M) {
					this.$message.error('上传图片大小不能超过 800kb!,请重新上传');
					this.fileList = fileList.slice(0, -1);
					return
				}
				this.fileList = fileList.slice(-1);
			},
			upLoadChange1(file, fileList) {
				const isLt2M = file.size / 1024 < 800;
				if (file.name.split(".")[1] != "jpg" && file.name.split(".")[1] != "png" && file.name.split(".")[1] != "jpeg") {
					this.$message.error('只能上传JPG/PNG/JPEG格式图片');
					this.fileList1 = fileList.slice(0, -1);
					return
				}
				if (!isLt2M) {
					this.$message.error('上传图片大小不能超过 800kb!,请重新上传');
					this.fileList1 = fileList.slice(0, -1);
					return
				}
				this.fileList1 = fileList.slice(-1);
			},
			upLoadChange2(file, fileList) {
				const isLt2M = file.size / 1024 < 800;
				if (file.name.split(".")[1] != "jpg" && file.name.split(".")[1] != "png" && file.name.split(".")[1] != "jpeg") {
					this.$message.error('只能上传JPG/PNG/JPEG格式图片');
					this.fileList2 = fileList.slice(0, -1);
					return
				}
				if (!isLt2M) {
					this.$message.error('上传图片大小不能超过 800kb!,请重新上传');
					this.fileList2 = fileList.slice(0, 10);
					return
				}
				this.fileList2 = fileList.slice(-10);
			},
			upLoadChange3(file, fileList) {
				const isLt2M = file.size / 1024 < 800;
				if (file.name.split(".")[1] != "jpg" && file.name.split(".")[1] != "png" && file.name.split(".")[1] != "jpeg") {
					this.$message.error('只能上传JPG/PNG/JPEG格式图片');
					this.fileList3 = fileList.slice(0, -1);
					return
				}
				if (!isLt2M) {
					this.$message.error('上传图片大小不能超过 800kb!,请重新上传');
					this.fileList3 = fileList.slice(0, -1);
					return
				}
				this.fileList3 = fileList.slice(-1);
			},
			//删除文件之前的函数
			upLoadRemove(file, fileList) {
				this.fileList = fileList;
			},
			upLoadRemove1(file, fileList) {
				this.fileList1 = fileList;
			},
			upLoadRemove2(file, fileList) {
				this.fileList2 = fileList;
			},
			upLoadRemove3(file, fileList) {
				this.fileList3 = fileList;
			},
			//上传照片
			uploadImage(imgList, i) {
				if (imgList.length > 0) {
					const formData = new FormData();
					formData.append("upfile", imgList[i].raw)
					return this.$axios({
						url: "/utils/upload/",
						method: "post",
						data: formData
					})
				}
			},
			async oprationUintPub(value) {
				let url = ''
				let method = ''
				let rowId = this.rowId ? this.rowId : ''
				//单张照片
				if(this.fileList.length != 0){
					if (this.fileList[0].raw) {
						const uploadRes = await this.uploadImage(this.fileList, 0)
						this.upImg1 = uploadRes.code === 0 ? uploadRes.detail : ''
					} else {
						this.upImg1 = this.fileList[0].url;
					}
				}
				if(this.fileList1.length != 0){
					if (this.fileList1[0].raw) {
						const uploadRes = await this.uploadImage(this.fileList1, 0)
						this.upImg2 = uploadRes.code === 0 ? uploadRes.detail : ''
					} else {
						this.upImg2 = this.fileList1[0].url
					}
				}
				if(this.fileList3.length != 0){
					if (this.fileList3[0].raw) {
						const uploadRes = await this.uploadImage(this.fileList3, 0)
						this.upImg4 = uploadRes.code === 0 ? uploadRes.detail : ''
					} else {
						this.upImg4 = this.fileList3[0].url
					}
				}
				//传多张
				if (this.fileList2.length != 0) {
					this.upImg3 = []
					let permises = []
					for (let i = 0; i < this.fileList2.length; i++) {
						if (this.fileList2[i].raw) {
							await permises.push(this.uploadImage(this.fileList2, i));
							permises[i].code === 0 && this.upImg3.push(permises[i].detail)
						} else {
							this.upImg3.push(this.fileList2[i].url);
						}
					}
					const res = await Promise.all(permises);
					for (let i = 0; i < res.length; i++) {
						res[i].code === 0 && this.upImg3.push(res[i].detail)
					}
				}
				//data数据
				let data = {
					company: this.form.company, //维保公司
					status: this.form.personStatus, //人员状态
					card_id: this.form.identity, //身份证号
					t1_card_no: this.form.t1Papers, //T1证号
					t1_end_time: this.form.t1PapersTime, //T1证有效期
					t2_card_no: this.form.t2Papers, //T2证号
					t2_end_time: this.form.t2PapersTime, //T2证有效期
					username: this.form.account, //账户
					contract_start_time: this.form.pactStartTime, //合同开始日期日期
					contract_end_time: this.form.pactEndTime, //合同开始日期日期
					pwd: this.form.pass, //密码
					real_name: this.form.trueName, //真实姓名
					phone: this.form.phoneNum, //手机号码
					t1_card_file: this.upImg1,
					t2_card_file: this.upImg2,
					contract_file: this.upImg3,
					social_security: this.upImg4,
					home_addr: this.form.homeAddress
				}
				if (value == 1) {
					url = '/user/person/'
					method = 'post'
				} else {
					url = '/user/person/' + rowId
					method = 'put'
				}
				axiosChange(url, method, data, (res) => {
					this.ensureBtn = false
					if (res.code == 0) {
						this.$message({
							type: 'success',
							message: '操作成功'
						})
						this.close(1)
					} else {
						this.$message.error(res.detail.result)
					}
				})
			},
			//获取编辑 详情数据
			getCompileList() {
				this.pwdListShow = false
				let rowId = this.rowId ? this.rowId : ''
				let url = '/user/person/' + rowId
				axiosGet(url, {}, (res) => {
					this.isLoading = false
					if (res.code == 0) {
						this.companyUnitArr = [{
							value: res.detail.company,
							label: res.detail.company_name
						}]
						this.form.company = res.detail.company
						if (res.detail.t1_card_file) {
							this.fileList = [{
								name: '',
								url: res.detail.t1_card_file
							}]
						} else {
							this.fileList = []
						}
						if (res.detail.t2_card_file) {
							this.fileList1 = [{
								name: '',
								url: res.detail.t2_card_file
							}]
						} else {
							this.fileList1 = []
						}

						this.fileList2 = res.detail.contract_file.map(item => ({
							name: '',
							url: item
						}))
						this.fileList3 = [{
							name: '',
							url: res.detail.social_security
						}]
						this.form.personStatus = res.detail.status
						this.form.identity = res.detail.card_id //身份证号
						this.form.t1Papers = res.detail.t1_card_no //T1证号
						this.form.t1PapersTime = res.detail.t1_end_time //T1证有效期
						this.form.t2Papers = res.detail.t2_card_no //T2证号
						this.form.t2PapersTime = res.detail.t2_end_time //T2证有效期
						this.form.account = res.detail.username //账户
						this.form.pactStartTime = res.detail.contract_start_time //合同开始日期日期
						this.form.pactEndTime = res.detail.contract_end_time //合同开始日期日期
						this.form.trueName = res.detail.real_name //真实姓名
						this.form.phoneNum = res.detail.phone //手机号码
						this.form.homeAddress = res.detail.home_addr
						this.signImg = res.detail.sign_image
						let message = !!res.detail.record.rec_status ? '更新成功' : '更新失败'
						this.updataType = message + '/' + res.detail.record.msg
						this.lastUpdataTime = res.detail.record.end_time
						if (Object.keys(res.detail.record).length > 0) {
							if (!!res.detail.record.ret_info) {
								this.recordCon1 = res.detail.record.ret_info
							} else {
								this.recordCon1 = {}
							}
							if (!!res.detail.record.reg_info) {
								this.recordCon = res.detail.record.reg_info
							} else {
								this.recordCon = {}
							}
						}
					} else {
						this.$message.error(res.detail.result)
					}
				})
			},
			//修改密码
			openPwd() {
				this.pwdListShow = !this.pwdListShow
			},
			//提交
			submit(ruleForm) {
				this.$refs[ruleForm].validate((valid) => {
					if (valid) {
						if (this.fileList.length == 0 && this.fileList1.length == 0) {
							this.$message.error('T1证附件/T2证附件请至少上传一份')
							return false
						}
						if (this.fileList.length != 0 && !this.form.t1Papers) {
							this.$message.error('T1证号码不能为空')
							return false
						}
						if (this.fileList.length != 0 && !this.form.t1PapersTime) {
							this.$message.error('T1证有效期不能为空')
							return false
						}

						if (this.fileList1.length != 0 && !this.form.t2Papers) {
							this.$message.error('T2证号码不能为空')
							return false
						}
						if (this.fileList1.length != 0 && !this.form.t2PapersTime) {
							this.$message.error('T2证有效期不能为空')
							return false
						}
						if (this.form.pactStartTime > this.form.pactEndTime) {
							this.$message.error('合同开始时间不能大于结束时间')
							return false
						}
						this.ensureBtn = true
						if (this.isAddOrComp == 1) {
							this.oprationUintPub(1)
						} else {
							this.oprationUintPub(2)
						}
					} else {
						console.log('error submit!!');
						return false;
					}
				});
			},
			//关闭
			close(value) {
				let newValue = 2
				if (value) {
					newValue = value
				}
				this.$emit('detailMaskShow', newValue)
			},
			closeImg() {
				this.imgDialogShow = false
			},
		}
	}
</script>
<style scoped lang="less">
</style>
